package dataBase;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.JSONLexer;
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import com.alibaba.fastjson2.JSONReader;


import java.lang.reflect.Type;

public class DataSetDeSerializer implements ObjectDeserializer {
    @Override
    public Object readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) {
        return ObjectDeserializer.super.readObject(jsonReader, fieldType, fieldName, features);
    }

    @Override
        public <T> T deserialze(DefaultJSONParser defaultJSONParser, Type type, Object o) {
        JSONLexer lexer = defaultJSONParser.getLexer();

        lexer.nextToken(JSONToken.COMMA);
        String str = lexer.stringVal();

        return null;
    }


        public static   void DataSetDeserialTest()
        {
            String str ="[{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"0\"},{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"1\"},{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"2\"},{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"3\"},{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"4\"},{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"5\"},{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"6\"},{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"7\"},{\"sex\":\"男\",\"name\":\"名字\",\"id\":\"8\"}]";
            DataSet ds = JSON.parseObject(str,DataSet.class);
            System.out.println(ds);
    }

    public static void main(String[] argc)
    {
        DataSetDeserialTest();
    }
}
